//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#include <string.h>
#include <elatypes.h>

EXTERN_C char * CDECL strcpy(char* pDest, const char* pSource)
{
#ifdef _GNUC
#if defined(_x86)
    int temp0, temp1, temp2;
    ASM("1:"
        "lodsb;"
        "stosb;"
        "testb %%al, %%al;"
        "jne 1b;"
        :"=D" (temp0), "=S" (temp1), "=a" (temp2)
        :"0" (pDest), "1" (pSource)
        :"memory");
    return pDest;
#endif    //if defined(_x86)

#endif    //ifdef _GNUC

    char *p = pDest;
    while ((*p++= *pSource++) != 0) // copy pSource to pDest
        ;
    return pDest;
}
